import { LazyLoad } from '@/library/widgets'
import type { IRoutesItem } from '@/router/baseType'
import { demoComponentsPaths } from './paths'

const DemoComponentsIndex = LazyLoad('demo-components')
const DemoComponentsDemoOne = LazyLoad('demo-components/demo-one')
const DemoComponentsDemoTwo = LazyLoad('demo-components/demo-two')
const DemoComponentsDemoFolder = LazyLoad('demo-components/demo-folder')
const DemoComponentsDemoThr = LazyLoad('demo-components/demo-folder/demo-thr')
const DemoComponentsDemoFour = LazyLoad('demo-components/demo-folder/demo-four')

export const DemoComponentsRoutes: IRoutesItem = {
  path: demoComponentsPaths.basePagePath,
  component: DemoComponentsIndex,
  auth: false,
  children: [
    {
      path: demoComponentsPaths.demoOne,
      component: DemoComponentsDemoOne,
      index: false,
    },
    {
      path: demoComponentsPaths.demoTwo,
      component: DemoComponentsDemoTwo,
    },
    {
      path: demoComponentsPaths.demoFolder,
      component: DemoComponentsDemoFolder,
      openDefaultIndex: true,
      children: [
        {
          path: demoComponentsPaths['demoFolder.thr'],
          component: DemoComponentsDemoThr,
        },
        {
          auth: false,
          path: demoComponentsPaths['demoFolder.four'],
          component: DemoComponentsDemoFour,
        },
      ],
    },
  ],
}
